import Vue from 'vue'
import Router from 'vue-router'
import {
  getWarningMsg
} from '@/api/dashboard/index'
Vue.use(Router)
import store from '../store'
import {
  getToken
} from '@/utils/auth' // get token from cookie

/* Layout */
import Layout from '@/layout'

// *
//  * Note: sub-menu only appear when route children.length >= 1
//  * hidden: true                   if set true, item will not show in the sidebar(default is false)
//  * alwaysShow: true               if set true, will always show the root menu
//  *                                if not set alwaysShow, when item has more than one children route,
//  *                                it will becomes nested mode, otherwise not show the root menu
//  * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
//  * name:'router-name'             the name is used by <keep-alive> (must set!!!)
//  * meta : {
//     roles: ['admin','editor']    control the page roles (you can set multiple roles)
//     title: 'title'               the name show in sidebar and breadcrumb (recommend set)
//     icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
//     breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
//     activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
//   }

/**
 *
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */

export const constantRoutes = [{
  path: '/login',
  component: () => import('@/views/login/index'),
  hidden: true
},
{
  path: '/404',
  component: () => import('@/views/404'),
  hidden: true
}
]

export const fastenRoutes = [
  // 玩法管理
  {
    path: '/rootplayrules',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootplayrules',
    sort: 4,
    meta: {
      title: '玩法管理',
      icon: 'icon-rules'
    },
    children: [
      // 功能子界面
      {
        path: 'lottery-result',
        name: 'lottery-result',
        hidden: true,
        component: () => import('@/views/playrulesmanager/lottery-result'),
        meta: {
          title: '开奖结果'
        }
      },
      {
        path: 'config-babylib',
        name: 'config-babylib',
        hidden: true,
        component: () => import('@/views/playrulesmanager/config-babylib'),
        meta: {
          title: '配置饰品'
        }
      },
      {
        path: 'config-babylibnew',
        name: 'config-babylibnew',
        hidden: true,
        component: () => import('@/views/playrulesmanager/config-babylibnew'),
        meta: {
          title: '配置饰品'
        }
      },
      {
        path: 'promotion-settlement-details',
        name: 'promotion-settlement-details',
        hidden: true,
        component: () => import('@/views/datamanager/settlementRecords/detail'),
        meta: {
          title: '推广结算详情'
        }
      },
      {
        path: 'bullet-setting',
        name: 'bullet-setting',
        hidden: true,
        component: () => import('@/views/playrulesmanager/bullet-setting'),
        meta: {
          title: '晶粹配置'
        }
      },
      {
        path: '/leiquName',
        name: 'leiquName',
        redirect: 'noRedirect',
        component: () => import('@/views/datamanager/user-behavior'),
        sortNum: 99,
        meta: {
          title: '雷区配置'
        },
        children: []
      }
    ]
  },
  // 福利系统
  {
    path: '/redpockets',
    component: Layout,
    redirect: 'noRedirect',
    name: 'RedPockets',
    sort: 6,
    meta: {
      title: '福利系统',
      icon: 'icon-red'
    },
    children: [{
      path: 'timepockets-detail',
      name: 'TimePocketsDetail',
      hidden: true,
      component: () => import('@/views/redpockets/timepockets-detail'),
      meta: {
        title: '红包详情'
      }
    },
    {
      path: 'codepockets-detail',
      name: 'CodePocketsDetail',
      hidden: true,
      component: () => import('@/views/redpockets/codepockets-detail'),
      meta: {
        title: '红包详情'
      }
    }

    ]
  },

  // 数据管理
  {
    path: '/rootdatamanager',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootdatamanager',
    alwaysShow: true,
    sort: 9,
    meta: {
      title: '数据管理',
      icon: 'icon-data'
    },
    children: [{
      path: 'userbehavior-data',
      name: 'Userbehaviordata',
      redirect: 'noRedirect',
      component: () => import('@/views/datamanager/user-behavior'),
      meta: {
        title: '用户行为数据'
      },
      children: [
      //   {
      //   path: 'playerbulletmanage',
      //   name: 'playerbulletmanage',
      //   component: () => import('@/views/datamanager/playerbulletmanage'),
      //   sort: 3,
      //   meta: {
      //     title: '玩家晶粹管理'
      //   },
      //   children: []
      // },
      // {
      //   path: 'playerflowingmanage',
      //   name: 'playerflowingmanage',
      //   component: () => import('@/views/datamanager/playerbulletmanage'),
      //   sort: 0,
      //   meta: {
      //     title: '主播流水管理'
      //   },
      //   children: []
      // },
      {
        path: 'battlemanage',
        name: 'battlemanage',
        component: () => import('@/views/datamanager/battlemanage'),
        sort: 5,
        meta: {
          title: '玩家对战管理'
        },
        children: []
      },
      // {
      //   path: 'playerpointmanage',
      //   name: 'playerpointmanage',
      //   component: () => import('@/views/datamanager/playerpointmanage'),
      //   sort: 4,
      //   meta: {
      //     title: '玩家积分管理'
      //   },
      //   children: []
      // },
      {
        path: 'playerbagmanager',
        name: 'playerbagmanager',
        component: () => import('@/views/datamanager/playerbagmanager'),
        sort: 7,
        meta: {
          title: '玩家背包管理'
        },
        children: []
      },
      {
        path: 'playerpickmanager',
        name: 'Playerpickmanager',
        component: () => import('@/views/datamanager/playerpickmanager'),
        sort: 8,
        meta: {
          title: '玩家提取管理'
        },
        children: []
      },

      // {
      //   path: 'playerextensionmanage',
      //   name: 'playerextensionmanage',
      //   component: () => import('@/views/datamanager/playerextensionmanage'),
      //   sort: 9,
      //   meta: {
      //     title: '玩家推广管理'
      //   },
      //   children: []
      // },
      {
        path: 'settlementRecords',
        name: 'settlementRecords',
        component: () => import('@/views/datamanager/settlementRecords'),
        sort: 10,
        meta: {
          title: '玩家结算记录'
        },
        children: []
      },
      {
        path: 'playerBalanceManage',
        name: 'playerBalanceManage',
        component: () => import('@/views/datamanager/playerBalanceManage'),
        sort: 10,
        meta: {
          title: '玩家余额管理'
        },
        children: []
      },
      ]
    }]
  },
  // 饰品库
  {
    path: '/rootbabylib',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootbaby',
    alwaysShow: true,
    sort: 10,
    meta: {
      title: '饰品库',
      icon: 'icon-lib'
    },
    children: []
  },
  {
    path: '/bullet',
    component: Layout,
    redirect: 'noRedirect',
    name: 'bullet',
    sort: 11,
    meta: {
      title: '数字卡库',
      icon: 'icon-card'
    },
    children: []
  },
  // 活动管理
  // {
  //   path: '/activitymanager',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'ActivityManagerRoot',
  //   sort: 8,
  //   meta: {
  //     icon: 'icon-activity',
  //     title: '活动管理'
  //   },
  //   children: [{
  //     path: '/activitycustom',
  //     name: 'ActivityCustom',
  //     redirect: 'noRedirect',
  //     component: () => import('@/views/datamanager/user-behavior'),
  //     meta: {
  //       title: '闯关活动'
  //     },
  //     children: []
  //   }]
  // },
  // 其他设置
  {
    path: '/rootothersetting',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootothersetting',
    sort: 13,
    meta: {
      title: '其他设置',
      icon: 'icon-setting'
    },
    children: []
  },
  // 权限管理
  {
    path: '/rootpermission',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootpermission',
    sort: 14,
    meta: {
      title: '角色权限管理',
      icon: 'icon-permission'
    },
    children: []
  },
  // 素材管理
  // {
  //   path: '/medialib',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   alwaysShow: true,
  //   name: 'medialib',
  //   sort: 11,
  //   meta: {
  //     title: '素材库',
  //     icon: 'icon-medialib'
  //   },
  //   children: []
  // },
  // 素材管理
  {
    path: '/Corporation',
    component: Layout,
    redirect: 'noRedirect',
    alwaysShow: true,
    name: 'Corporation',
    sort: 12,
    meta: {
      title: '公司主播管理',
      icon: 'icon-company'
    },
    children: []
  },
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
// 信息管理
export const rootInfoRoute = {
  path: '/rootinfo',
  component: Layout,
  redirect: 'noRedirect',
  name: 'Rootinfo',
  sort: 2,
  meta: {
    title: '信息管理',
    icon: 'icon-info',
    id: 2,
    tallest: true
  },
  children: [{
    path: 'info-websites',
    name: 'Infowebsite',
    component: () => import('@/views/infomanager/info-website'),
    meta: {
      title: '站内信息'
    }
  },
  {
    path: 'info-Instructions',
    name: 'infoInstructions',
    component: () => import('@/views/infomanager/info-Instructions'),
    meta: {
      title: '玩法说明'
    }
  },
  {
    path: 'info-banner',
    name: 'Infobanner',
    component: () => import('@/views/infomanager/info-banner'),
    meta: {
      title: 'Banner管理'
    }
  }
  ]
}

// 用户管理
export const rootUserRoute = {
  path: '/rootuser',
  component: Layout,
  redirect: 'noRedirect',
  name: 'Rootuser',
  alwaysShow: true,
  sort: 3,
  meta: {
    title: '用户管理',
    icon: 'icon-usermanger'
  },
  children: [{
    path: 'user-manager',
    name: 'Usermanager',
    component: () => import('@/views/usermanager/index'),
    meta: {
      title: '用户管理'
    }
  }]
}

// 任务墙
export const taskWallRoute = {
  // path: '/taskwall',
  // component: Layout,
  // redirect: 'noRedirect',
  // name: 'TaskWall',
  // sort: 7,
  // meta: {
  //   title: '任务墙',
  //   icon: 'icon-task'
  // },
  // children: [{
  //   path: 'taskmanager',
  //   name: 'taskmanager',
  //   component: () => import('@/views/taskwall/taskmanager'),
  //   meta: {
  //     title: '任务管理'
  //   }
  // },
  // {
  //   path: 'lotterymanager',
  //   name: 'lotterymanager',
  //   component: () => import('@/views/taskwall/lotterymanager'),
  //   meta: {
  //     title: '抽奖管理'
  //   }
  // },
  // {
  //   path: 'giftcategorymanager',
  //   name: 'GiftCategoryManager',
  //   hidden: true,
  //   component: () => import('@/views/taskwall/giftcategorymanager'),
  //   meta: {
  //     title: '分类管理'
  //   }
  // },
  // {
  //   path: 'config-gift',
  //   name: 'config-gift',
  //   hidden: true,
  //   component: () => import('@/views/taskwall/config-gift'),
  //   meta: {
  //     title: '配置礼品'
  //   }
  // }
  // ]
}

// 免费箱子
export const freeboxRoute = {
  // path: 'free-box',
  // name: 'Freebox',
  // component: () => import('@/views/playrulesmanager/free-box'),
  // meta: {
  //   title: '免费箱子'
  // }
}

// 伪造首页
export const dashboardRoute = {
  path: '/',
  component: Layout,
  hidden: true,
  redirect: '/dashboard',
  sort: 1,
  meta: {
    id: 1,
    tallest: true
  },
  children: [{
    path: 'dashboard',
    name: 'Dashboard',
    component: () => import('@/views/dashboard/forged.vue'),
    meta: {
      title: '主页',
      affix: true,
      noCache: true
    }
  }]
}

// 权限动图表
export const asyncRoutes = [
  // 主页
  {
    path: '/',
    component: Layout,
    hidden: true,
    redirect: '/dashboard',
    sort: 1,
    meta: {
      id: 1,
      tallest: true
    },
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: {
        title: '主页',
        affix: true,
        noCache: true
      }
    }]
  },
  // {
  // 	path: '/',
  // 	component: Layout,
  // 	hidden: true,
  // 	redirect: '/dashboard',
  // 	sort: 1,
  // 	meta: {
  // 		id: 1,
  // 		tallest: true
  // 	},
  // 	children: [{
  // 		path: 'dashboard',
  // 		name: 'Dashboard',
  // 		component: () => import('@/views/dashboard/forged.vue'),
  // 		meta: {
  // 			title: '主页',
  // 			affix: true,
  // 			noCache: true
  // 		}
  // 	}]
  // },
  // 玩法管理
  {
    path: '/rootplayrules',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootplayrules',
    meta: {
      title: '玩法管理',
      icon: 'icon-rules'
    },
    children: [{
      path: 'normal-box',
      name: 'Normalbox',
      sortNum: 1,
      component: () => import('@/views/playrulesmanager/normal-box'),
      meta: {
        title: '心跳时刻',
        id: 7,
        parentName: 'Rootplayrules'
      }
    },
    {
      path: 'roll-room',
      name: 'Rollroom',
      sortNum: 2,
      component: () => import('@/views/playrulesmanager/roll-room'),
      meta: {
        title: 'Roll 房福利',
        id: 11,
        parentName: 'Rootplayrules'
      }
    },
    // {
    //   path: 'luky-box',
    //   name: 'Lukybox',
    //   sortNum: 3,
    //   component: () => import('@/views/playrulesmanager/luky-box'),
    //   meta: {
    //     title: '幸运开箱',
    //     id: 12,
    //     parentName: 'Rootplayrules'
    //   }
    // },
    // {
    //   path: 'replacement-contract',
    //   name: 'ReplacementContract',
    //   sortNum: 4,
    //   component: () => import('@/views/playrulesmanager/replacement-contract'),
    //   meta: {
    //     title: '汰换合约',
    //     id: 13,
    //     parentName: 'Rootplayrules'
    //   }
    // },
    {
      path: 'battle-competition',
      name: 'BattleCompetition',
      sortNum: 5,
      component: () => import('@/views/playrulesmanager/battle-competition'),
      meta: {
        title: '欧皇战场',
        id: 14,
        parentName: 'Rootplayrules'
      }
    },
    {
      path: 'box-setting',
      name: 'BoxSetting',
      sortNum: 6,
      component: () => import('@/views/playrulesmanager/box-setting'),
      meta: {
        title: '箱子配置',
        id: 15,
        parentName: 'Rootplayrules'
      }
    }, 
      // 晶粹商城
      {
        path: 'bullet-store',
        name: 'Bullet',
        sortNum: 6,
        component: () => import('@/views/bullet/bullet-store'),
        meta: {
          title: '晶粹商城',
          id: 16,
          parentName: 'Rootplayrules'
        }
      }, 
    {
      path: 'minefield-setting',
      name: 'minefieldSetting',
      component: () => import('@/views/playrulesmanager/minefield-setting'),
      sortNum: 8,
      meta: {
        title: '雷场配置',
        id: 67,
        parentName: 'leiquName'
      }
    },
    {
      path: 'minefield-manage',
      name: 'minefieldManage',
      sortNum: 7,
      component: () => import('@/views/playrulesmanager/minefield-manage'),
      hidden: true,
      meta: {
        title: '雷区管理',
        id: 67,
        parentName: 'leiquName'
      }
    }
    ]
  },


  // 福利系统
  {
    path: '/redpockets',
    component: Layout,
    redirect: 'noRedirect',
    name: 'RedPockets',
    meta: {
      title: '福利系统',
      icon: 'icon-red'
    },
    children: [
    //   {
    //   path: 'rebate-redpockets',
    //   name: 'rebateRedpockets',
    //   component: () => import('@/views/redpockets/rebate-redpockets'),
    //   meta: {
    //     title: '返利红包',
    //     id: 54,
    //     parentName: 'RedPockets'
    //   }
    // },
    // {
    //   path: 'sign-redpockets',
    //   name: 'SigneRed',
    //   component: () => import('@/views/redpockets/sign-redpockets'),
    //   meta: {
    //     title: '签到红包',
    //     id: 54,
    //     parentName: 'RedPockets'
    //   }
    // },
    {
      path: 'code-redpockets',
      name: 'CodeRed',
      component: () => import('@/views/redpockets/code-redpockets'),
      meta: {
        title: '多码红包',
        id: 21,
        parentName: 'RedPockets'
      }
    },
    // {
    // 	path: 'rebate-redpockets',
    // 	name: 'rebateRedpockets',
    // 	hidden: true,
    // 	component: () => import('@/views/redpockets/rebate-redpockets'),
    // 	meta: {
    // 		title: '返利红包'
    // 	}
    // },
    {
      path: 'time-redpockets',
      name: 'TimeRed',
      component: () => import('@/views/redpockets/time-redpockets'),
      meta: {
        title: '手气红包',
        id: 22,
        parentName: 'RedPockets'
      }
    },
    {
      path: 'blood-redpockets',
      name: 'BloodRed',
      component: () => import('@/views/redpockets/blood-redpockets'),
      meta: {
        title: '奖励红包',
        id: 23,
        parentName: 'RedPockets'
      }
    },
    {
      path: 'activity-redpockets',
      name: 'ActivityRed',
      component: () => import('@/views/redpockets/activity-redpockets'),
      meta: {
        title: '活动红包',
        id: 24,
        parentName: 'RedPockets'
      }
    },
    {
      path: 'register-redpockets',
      name: 'RegisterRed',
      component: () => import('@/views/redpockets/register-redpockets'),
      meta: {
        title: '注册红包',
        id: 25,
        parentName: 'RedPockets'
      }
    },
    {
      path: 'vipSystem',
      name: 'vipSystem',
      component: () => import('@/views/redpockets/vipSystem'),
      meta: {
        title: 'VIP系统',
        id: 87,
        parentName: 'RedPockets'
      }
    }
    ]
  },
  // 数据管理
  {
    path: '/rootdatamanager',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootdatamanager',
    alwaysShow: true,
    meta: {
      title: '数据管理',
      icon: 'icon-data'
    },
    children: [
      {
      path: 'userbehavior-data',
      name: 'Userbehaviordata',
      redirect: 'noRedirect',
      component: () => import('@/views/datamanager/user-behavior'),
      meta: {
        title: '用户行为数据'
      },
      children: [{
        path: 'avatar-datamanager',
        name: 'AvatarDataManager',
        component: () => import('@/views/datamanager/avatar-datamanager'),
        meta: {
          sort: 12,
          title: '头像框管理',
          id: 50,
          parentName: 'Userbehaviordata'
        }
      },
      {
        path: 'TieYards',
        name: 'TieYards',
        component: () => import('@/views/datamanager/TieYards'),
        meta: {
          sort: 13,
          title: '玩家绑码记录',
          id: 58,
          parentName: 'Userbehaviordata'
        }
      },
      {
        path: 'RealApprove',
        name: 'RealApprove',
        component: () => import(
          '@/views/datamanager/BindingRecord/RealApprove.vue'),
        meta: {
        // id: 107,
          id: 84,
          title: '实名认证记录',
          parentName: 'Userbehaviordata'
        }
      },
      /**/
      // {
      //   path: 'playerflowingmanage',
      //   name: 'playerflowingmanage',
      //   component: () => import('@/views/datamanager/playerbulletmanage'),
      //   meta: { title: '主播流水管理' },
      //   children: [
      //     {
      //       path: 'kol-bill',
      //       name: 'Kolbill',
      //       component: () => import('@/views/datamanager/kol-bill'),
      //       sort: 1,
      //       meta: {
      //         title: '主播流水管理',
      //         id: 26,
      //         parentName: 'playerflowingmanage'
      //       }
      //     },

      //     {
      //       path: 'kol-summary',
      //       name: 'Kolsummary',
      //       component: () => import('@/views/datamanager/kolBillbox/summary'),
      //       sort: 1,
      //       meta: {
      //         title: '主播流水统计',
      //         id: 64,
      //         parentName: 'playerflowingmanage'
      //       }
      //     }
      //   ]
      // },
      // {
      //   path: 'player-pay',
      //   name: 'Playerpay',
      //   component: () => import('@/views/datamanager/player-pay'),
      //   sort: 2,
      //   meta: {
      //     title: '玩家消费管理',
      //     id: 27,
      //     parentName: 'Userbehaviordata'
      //   }
      // },
      // {
      //   path: 'playerbulletmanage',
      //   name: 'playerbulletmanage',
      //   component: () => import('@/views/datamanager/playerbulletmanage'),
      //   meta: {
      //     title: '玩家晶粹管理'
      //   },
      //   children: [{
      //     path: 'player-bullet',
      //     name: 'PlayerBullet',
      //     component: () => import(
      //       '@/views/datamanager/playerbulletmanage/player-bullet'),
      //     meta: {
      //       title: '晶粹变化记录',
      //       id: 28,
      //       parentName: 'playerbulletmanage'
      //     }
      //   },
      //   {
      //     path: 'player-bullet-charge',
      //     name: 'PlayerBulletCharge',
      //     component: () => import(
      //       '@/views/datamanager/playerbulletmanage/player-bullet-charge'),
      //     meta: {
      //       title: '晶粹兑换记录',
      //       id: 29,
      //       parentName: 'playerbulletmanage'
      //     }
      //   }
      //   ]
      // },
      // {
      //   path: 'playerpointmanage',
      //   name: 'playerpointmanage',
      //   component: () => import('@/views/datamanager/playerpointmanage'),

      //   meta: {
      //     title: '玩家积分管理'
      //   },
      //   children: [{
      //     path: 'player-point-change',
      //     name: 'PlayerPointChange',
      //     component: () => import(
      //       '@/views/datamanager/playerpointmanage/player-point-change'),
      //     meta: {
      //       title: '积分变更记录',
      //       id: 30,
      //       parentName: 'playerpointmanage'
      //     }
      //   },
      //   {
      //     path: 'player-point-lottry',
      //     name: 'PlayerPointlottry',
      //     component: () => import(
      //       '@/views/datamanager/playerpointmanage/player-point-lottry'),
      //     meta: {
      //       title: '积分抽奖记录',
      //       id: 31,
      //       parentName: 'playerpointmanage'
      //     }
      //   }
      //   ]
      // },
      {
        path: 'battlemanage',
        name: 'battlemanage',
        component: () => import('@/views/datamanager/battlemanage'),
        meta: {
          title: '玩家对战管理'
        },
        children: [{
          path: 'battleroom-record',
          name: 'BattleroomRecord',
          component: () => import(
            '@/views/datamanager/battlemanage/battleroom-record'),
          meta: {
            title: '对战房间记录',
            id: 32,
            parentName: 'battlemanage'
          }
        },
        {
          path: 'battleplayer-record',
          name: 'BattleplayerRecord',
          component: () => import(
            '@/views/datamanager/battlemanage/battleplayer-record'),
          meta: {
            title: '对战玩家记录',
            id: 33,
            parentName: 'battlemanage'
          }
        },
        {
          path: 'battleplayer-open',
          name: 'BattleplayerOPen',
          component: () => import(
            '@/views/datamanager/battlemanage/battleplayer-open'),
          meta: {
            title: '对战开箱记录',
            id: 57,
            parentName: 'battlemanage'
          }
        }
        ]
      },

      // {
      //   path: 'player-openbox',
      //   name: 'Playeropenboxmanager',
      //   component: () => import('@/views/datamanager/player-openbox'),
      //   sort: 6,
      //   meta: {
      //     title: '玩家开箱管理',
      //     id: 34,
      //     parentName: 'Userbehaviordata'
      //   }
      // },
      {
        path: 'Mine_clearance',
        name: 'MineClearance',
        component: () => import('@/views/datamanager/MineClearance'),
        sort: 3,
        meta: {
          title: '用户扫雷数据管理',
          id: 65,
          parentName: 'Userbehaviordata'
        },
        children: [{
          path: 'clearance-record',
          name: 'ClearanceRecord',
          component: () => import(
            '@/views/datamanager/MineClearance/clearance-record'),
          meta: {
            title: '用户扫雷记录',
            id: 65,
            parentName: 'MineClearance'
          }
        },
        {
          path: 'clearance-statistics',
          name: 'ClearanceStatistics',
          component: () => import(
            '@/views/datamanager/MineClearance/clearance-statistics'),
          meta: {
            title: '用户扫雷统计',
            id: 66,
            parentName: 'MineClearance'
          }
        }
        ]
      },
      // {
      //   path: 'replacement-note',
      //   name: 'ReplacementNote',
      //   component: () => import('@/views/datamanager/replacement-note'),
      //   sort: 7,
      //   meta: {
      //     title: '玩家汰换管理',
      //     id: 35,
      //     parentName: 'Userbehaviordata'
      //   }
      // },
      {
        path: 'playerbagmanager',
        name: 'playerbagmanager',
        component: () => import('@/views/datamanager/playerbagmanager'),

        meta: {
          title: '玩家背包管理'
        },
        children: [{
          path: 'player-bags',
          name: 'playerbags',
          component: () => import(
            '@/views/datamanager/playerbagmanager/player-bags'),
          meta: {
            title: '玩家背包记录',
            id: 37,
            parentName: 'playerbagmanager'
          }
        },
        // {
        //   path: 'point-record',
        //   name: 'pointRecord',
        //   component: () => import(
        //     '@/views/datamanager/playerbagmanager/point-record'),
        //   meta: {
        //     title: '积分礼品记录',
        //     id: 38,
        //     parentName: 'playerbagmanager'
        //   }
        // }
      ]
      },
      {
        path: 'playerpickmanager',
        name: 'Playerpickmanager',
        component: () => import('@/views/datamanager/playerpickmanager'),
        meta: {
          title: '玩家提取管理'
        },
        children: [{
          path: 'player-pick',
          name: 'Playerpick',
          component: () => import(
            '@/views/datamanager/playerpickmanager/player-pick'),
          meta: {
            title: '饰品提取记录',
            id: 39,
            parentName: 'Playerpickmanager'
          }
        },
        // {
        //   path: 'award-record',
        //   name: 'awardRecord',
        //   component: () => import(
        //     '@/views/datamanager/playerpickmanager/award-record'),
        //   meta: {
        //     title: '实物提取记录',
        //     id: 40,
        //     parentName: 'Playerpickmanager'
        //   }
        // }
        ]
      },
      {
        path: 'settlementRecords',
        name: 'settlementRecords',
        component: () => import('@/views/datamanager/settlementRecords'),
        meta: {
          title: '推广结算记录'
        },
        children: [{
          path: 'settlementRecords',
          name: 'settlementRecords',
          component: () => import('@/views/datamanager/settlementRecords/index.vue'),
          meta: {
            title: '推广结算记录',
            id: 88,
            parentName: 'settlementRecords'
          }
        }]
      },
      {
        path: 'playerBalanceManage',
        name: 'playerBalanceManage',
        component: () => import('@/views/datamanager/playerBalanceManage'),
        meta: {
          title: '玩家余额管理'
        },
        children: [
          {
            path: 'player-pay',
            name: 'Playerpay',
            component: () => import('@/views/datamanager/playerBalanceManage/player-pay'),
            meta: {
              title: '玩家消费记录',
              id: 90,
              parentName: 'playerBalanceManage'
            }
          },
          {
            path: 'balance',
            name: 'balance',
            component: () => import('@/views/datamanager/playerBalanceManage/balance'),
            meta: {
              id: 91,
              title: '玩家余额记录',
              parentName: 'playerBalanceManage'
            }
          },
          {
          path: 'player_balance_manage',
          name: 'player_balance_manage',
          component: () => import('@/views/datamanager/playerBalanceManage/balanceRecords.vue'),
          meta: {
            title: '玩家消耗记录',
            id: 89,
            parentName: 'playerBalanceManage'
          }
        },
        // {
        //   path: 'rechargeStatistics',
        //   name: 'rechargeStatistics',
        //   component: () => import('@/views/datamanager/playerBalanceManage/rechargeStatistics'),
        //   meta: {
        //     id: 41,
        //     title: '消费统计',
        //     parentName: 'playerBalanceManage'
        //   }
        // },
   
        ]
      },
      // {
      //   path: 'playerextensionmanage',
      //   name: 'playerextensionmanage',
      //   component: () => import('@/views/datamanager/playerextensionmanage'),
      //   meta: {
      //     title: '玩家余额管理'
      //   },
      //   children: [{
      //     path: 'player-extension',
      //     name: 'PlayerExtention',
      //     component: () => import(
      //       '@/views/datamanager/playerextensionmanage/player-extension'),
      //     meta: {
      //       title: '消耗记录',
      //       id: 41,
      //       parentName: 'playerextensionmanage'
      //     }
      //   }
      //   ]
      // },
      // {
      //   path: 'playerextensionmanage',
      //   name: 'playerextensionmanage',
      //   component: () => import('@/views/datamanager/playerextensionmanage'),
      //   meta: {
      //     title: '玩家推广管理'
      //   },
      //   children: [
      //     {
      //     path: 'player-extension',
      //     name: 'PlayerExtention',
      //     component: () => import(
      //       '@/views/datamanager/playerextensionmanage/player-extension'),
      //     meta: {
      //       title: '玩家推广记录',
      //       id: 41,
      //       parentName: 'playerextensionmanage'
      //     }
      //   },
      //   {
      //     path: 'player-extension-charge',
      //     name: 'PlayerExtensionCharge',
      //     component: () => import(
      //       '@/views/datamanager/playerextensionmanage/player-extension-charge'
      //     ),
      //     meta: {
      //       title: '推广消费记录',
      //       id: 42,
      //       parentName: 'playerextensionmanage'
      //     }
      //   }
      //   ]
      // }
      ]
    }]
  },
  // 饰品库
  {
    path: '/rootbabylib',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootbaby',
    alwaysShow: true,
    meta: {
      title: '饰品库',
      icon: 'icon-lib'
    },
    children: [{
      path: 'market-babylib',
      name: 'Marketbabylib',
      component: () => import('@/views/babylib/market-babylib'),
      meta: {
        title: '市场饰品库',
        id: 43,
        parentName: 'Rootbaby'
      }
    },
    {
      path: 'platform-babylib',
      name: 'Platformbabylib',
      component: () => import('@/views/babylib/platform-babylib'),
      meta: {
        title: '平台饰品库',
        id: 44,
        parentName: 'Rootbaby'
      }
    }
    ]
  },
     // 公司管理1111
     {
      path: '/Corporation',
      component: Layout,
      redirect: 'noRedirect',
      name: 'Corporation',
      alwaysShow: true,
      meta: {
        title: '公司主播管理',
        icon: 'icon-company'
      },
      children: [
        {
          path: 'viewCompany',
          name: 'viewCompany',
          component: () => import('@/views/company/viewCompany'),
          meta: {
            title: '查看公司',
            id: 81,
            parentName: 'Corporation'
          }
        },
        {
  
          path: 'boos_org',
          name: 'boosOrg',
          component: () => import('@/views/datamanager/boos_org'),
          meta: {
            title: '公司管理',
            id: 80,
            parentName: 'Corporation'
          }
        }
        // {
        //   path: '/viewCompany',
        //   name: 'viewCompany',
        //   component: () => import('@/views/company/viewCompany'),
        //   meta: {
        //     title: '查看公司',
        //     id: 377,
        //     parentName: 'Rootpermission'
        //   }
        // }
      ]
    },
  {
    path: '/bullet',
    component: Layout,
    redirect: 'noRedirect',
    name: 'bullet',
    alwaysShow: true,
    meta: {
      title: '数字卡库',
      icon: 'icon-lib'
    },
    children: [
      {
        path: 'bullet-card',
        name: 'Bulletcard',
        component: () => import('@/views/bullet/bullet-card'),
        meta: {
          id: 85,
          title: '平台数字卡库',
          parentName: 'bullet'
        }
      },
      {
        path: 'authenticRightRecord',
        name: 'authenticRightRecord',
        component: () => import('@/views/bullet/authenticRightRecord'),
        meta: {
          id: 86,
          title: '确权记录',
          parentName: 'bullet'
        }
      }
    ]
  },
  // 活动管理
  // {
  //   path: '/activitymanager',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'ActivityManagerRoot',
  //   sort: 8,
  //   meta: {
  //     icon: 'icon-activity',
  //     title: '活动管理'
  //   },
  //   children: [
  //     {
  //       path: '/activitycustom',
  //       name: 'ActivityCustom',
  //       redirect: 'noRedirect',
  //       component: () => import('@/views/datamanager/user-behavior'),
  //       meta: {
  //         title: '闯关活动'
  //       },
  //       children: [{
  //         path: '/rush-manager',
  //         name: 'rush-manager',
  //         component: () => import('@/views/activitymanager/rushManager/rush-manager'),
  //         meta: {
  //           title: '闯关活动管理',
  //           id: 62,
  //           parentName: 'ActivityCustom'
  //         }
  //       },
  //       {
  //         path: '/rush-level-manager',
  //         name: 'rush-level-manager',
  //         component: () => import('@/views/activitymanager/rushManager/rush-level-manager'),
  //         hidden: true,
  //         meta: {
  //           title: '关卡管理',
  //           id: 62,
  //           parentName: 'ActivityCustom'
  //         }
  //       },
  //       {
  //         path: '/Ranking-management',
  //         name: 'Ranking-management',
  //         component: () => import('@/views/activitymanager/rushManager/ranking-management'),
  //         hidden: true,
  //         meta: {
  //           title: '排行榜管理',
  //           id: 62,
  //           parentName: 'ActivityCustom'
  //         }
  //       },
  //       {
  //         path: '/Ranking-management-new',
  //         name: 'Ranking-management-new',
  //         component: () => import('@/views/activitymanager/rushManager/ranking-management-new'),
  //         hidden: true,
  //         meta: {
  //           title: '排行榜设置',
  //           id: 62,
  //           parentName: 'ActivityCustom'
  //         }
  //       },
  //       {
  //         path: '/rush-data-manager',
  //         name: 'rush-data-manager',
  //         component: () => import('@/views/activitymanager/rushManager/rush-data-manager'),
  //         meta: {
  //           title: '闯关记录',
  //           id: 59,
  //           parentName: 'ActivityCustom'
  //         }
  //       },
  //       {
  //         path: '/rush-data-open-manager',
  //         name: 'rush-data-open-manager',
  //         component: () => import('@/views/activitymanager/rushManager/rush-data-open-manager'),
  //         meta: {
  //           title: '开箱记录',
  //           id: 60,
  //           parentName: 'ActivityCustom'
  //         }
  //       }
  //       ]
  //     },
  //     {
  //       path: 'activity-manager',
  //       name: 'ActivityManager',
  //       component: () => import('@/views/activitymanager/activity-manager'),
  //       meta: {
  //         title: '活动管理',
  //         id: 52,
  //         parentName: 'ActivityManagerRoot'
  //       }
  //     },
  //     {
  //       path: 'vote-manager',
  //       name: 'VoteManager',
  //       component: () => import('@/views/activitymanager/vote-manager'),
  //       meta: {
  //         title: '投票管理',
  //         id: 63,
  //         parentName: 'ActivityManagerRoot'
  //       }
  //     },
  //     {
  //       path: 'syntheticData-manager',
  //       name: 'syntheticDataManager',
  //       component: () => import('@/views/activitymanager/syntheticData-manager'),
  //       meta: {
  //         title: '合成数据管理',
  //         id: 56,
  //         parentName: 'ActivityManagerRoot'
  //       }
  //     },
  //     {
  //       path: 'DuanwuFestival-manager',
  //       name: 'DuanwuFestivalManager',
  //       component: () => import('@/views/activitymanager/DuanwuFestival-manager'),
  //       meta: {
  //         title: '端午合成数据',
  //         // id: 70,
  //         id: 56,
  //         parentName: 'ActivityManagerRoot'
  //       }
  //     }
  //   ]
  // },

  // 素材管理
  // {
  //   path: '/medialib',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   alwaysShow: true,
  //   name: 'medialib',
  //   sort: 11,
  //   meta: {
  //     title: '素材库',
  //     icon: 'icon-medialib'
  //   },
  //   children: [{
  //     path: 'avatar-lib',
  //     name: 'avatar-lib',
  //     component: () => import('@/views/medialib/avatar-lib'),
  //     meta: {
  //       title: '头像框库',
  //       id: 51,
  //       parentName: 'medialib'
  //     }
  //   }]
  // },

  // 其他设置
  {
    path: '/rootothersetting',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootothersetting',
    meta: {
      title: '其他设置',
      icon: 'icon-setting'
    },
    children: [{
      path: 'system-setting',
      name: 'Systemsetting',
      component: () => import('@/views/othersetting/system-setting'),
      meta: {
        title: '相关设置',
        id: 45,
        parentName: 'Rootothersetting'
      }
    },
    {
      path: 'pay-setting',
      name: 'PaySetting',
      component: () => import('@/views/othersetting/pay-setting'),
      meta: {
        title: '支付配置',
        id: 46,
        parentName: 'Rootothersetting'
      }
    },
    {
      path: 'dict',
      name: 'dict',
      component: () => import('@/views/dict'),
      meta: {
        title: '字典管理',
        id: 69,
        parentName: 'Rootothersetting'
      }
    },
    {
      path: 'dictDetails',
      name: 'dictDetails',
      component: () => import('@/views/dict/dictDetails'),
      hidden: true,
      meta: {
        title: '字典详情',
        id: 69,
        parentName: 'Rootothersetting'
      }
    },
    {
      path: 'system-log',
      name: 'Systemlog',
      component: () => import('@/views/othersetting/system-log'),
      meta: {
        title: '操作日志',
        id: 47,
        parentName: 'Rootothersetting'
      }
    }
    ]
  },
  // 权限管理
  {
    path: '/rootpermission',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Rootpermission',
    meta: {
      title: '角色权限管理',
      icon: 'icon-permission'
    },
    children: [{
      path: 'permission-manager',
      name: 'PermissionManager',
      component: () => import('@/views/permission/permission-manager'),
      meta: {
        title: '角色权限管理',
        id: 48,
        parentName: 'Rootpermission'
      }
    }]
  }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

router.beforeEach((to, from, next) => {
  if (getToken()) {
    getWarningMsg().then(res => {
      store.dispatch('app/triggerWarning', res.data)
    })
  }
  next()
})

export default router
